Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
w3c-keyname
Advanced tools
The w3c-keyname package is a utility library that helps in converting keyboard event key names to strings that are consistent with the W3C key names specification. This is particularly useful for handling keyboard interactions in web applications in a way that is consistent across different browsers and platforms.
Convert key event to W3C key name
This feature allows you to pass a keyboard event object to the `keyName` function, which returns the W3C-compliant key name as a string. This is useful for identifying keys in a standardized manner.
"import { keyName } from 'w3c-keyname';\n\nconst event = new KeyboardEvent('keydown', {key: 'ArrowLeft'});\nconsole.log(keyName(event)); // 'ArrowLeft'"
The 'keycode' package translates keyboard codes and key names to and from numeric key codes. It is similar to w3c-keyname in that it helps with keyboard event handling, but it focuses on key codes rather than standardized W3C key names.
KeyboardJS is a library for binding keyboard combos without the pain of key codes and key names. It allows for complex key combinations and sequences, offering a higher-level abstraction compared to w3c-keyname. While w3c-keyname standardizes key names, KeyboardJS focuses on creating comprehensive keyboard interaction experiences.
Tiny library that exports a function keyName
that takes a keyboard event and
returns a
KeyboardEvent.key
-style
string. Will use the actual key
property of the event if available,
and fall back to a value synthesized from the keyCode
otherwise.
Probably often wrong on non-US keyboards, since the correspondence
between a key code and the character it produces when shift is held is
predicted based on a hard-coded table. Meant as a fallback for
KeyboardEvent.key
, not a replacement.
The lookup tables from key codes (event.keyCode
) to names are
exported as base
(when Shift isn't held) and shift
(when Shift is
held).
License: MIT
FAQs
Get a KeyboardEvent.key-style string from an event
The npm package w3c-keyname receives a total of 2,784,114 weekly downloads. As such, w3c-keyname popularity was classified as popular.
We found that w3c-keyname demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.